package com.example.cpl.gjc;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;

import java.util.Timer;
import java.util.TimerTask;

public class Main2Activity extends AppCompatActivity {
    private VideoView mVideoView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

//        mVideoView= (VideoView) findViewById(R.id.videoView);
//
//        final Uri vUri = Uri.parse("android.resource://" + getPackageName() + "/" +R.raw.v3_84);
//        mVideoView.setVideoURI(vUri);
//        mVideoView.setMediaController(new MediaController(Main2Activity.this));
//        mVideoView.start();
//
//        MediaController mc = new MediaController(this);     //隐藏videoview进度条或者控制部分
//        mc.setVisibility(View.INVISIBLE);
//        mVideoView.setMediaController(mc);
//
//        //监听视频播放完的代码
//        mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
//            @Override
//            public void onCompletion(MediaPlayer mPlayer) {
//                // TODO Auto-generated method stub
//                mPlayer.start();
//                mPlayer.setLooping(true);           //循环播放
//            }
//        });
//        /*********     如果WiFi没有打开 就打开WiFi     ***********/
//        WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
//        WifiInfo wifiInfo = wifiManager.getConnectionInfo();
//        WifiAdmin wifiAdmin = new WifiAdmin(Main2Activity.this);
//        ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
//        NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
//        if((wifiInfo.getSSID().equals("<unknown ssid>"))||(!mWifi.isConnected())) {
//            wifiAdmin.openWifi();
//        }
//        /****************************************************/
//
//        new Timer().schedule(new TimerTask() {
//            @SuppressLint("PrivateResource")
//            @Override
//            public void run() {
                Intent intent = new Intent(Main2Activity.this, teach_center.class);
                startActivity(intent);
                overridePendingTransition(R.anim.abc_slide_in_bottom, R.anim.abc_slide_out_bottom);
                finish();  //如果不加finish 退出程序总会显示欢迎界面 因为没有结束

//            }
//        }, 8700);
//
    }

}
